﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WG计划管理工具
{
    public partial class frmJHHTBrowse : Form
    {
        string strSelectJHHT = "select jhb024 合同号,jhb005 型号规格,生产计划数量,jhb009 交货期 from scjhb_table,wgjhht where 生产计划号=jhb001 and 生产计划项次=jhb002 and 计划单号='@计划单号' and 计划项次=@计划项次 order by jhb024";

        public frmJHHTBrowse(string strTmpPPNo,string strTmpPX)
        {
            InitializeComponent();
            iniDataSource(strTmpPPNo, strTmpPX);
            txtWGPPNo.Text = strTmpPPNo;
            txtWGPX.Text = strTmpPX;
        }

        private void iniDataSource(string strTmpPPNo, string strTmpPX)
        {
            SqlTools .SqlTools sqt =new SqlTools.SqlTools (WG计划管理工具.Properties.Settings.Default.ConnectionString );
            DataTable tmpdt = sqt.GetDataTable(strSelectJHHT.Replace("@计划单号", strTmpPPNo)
                                                                                              .Replace ("@计划项次",strTmpPX ));
            dgv1.DataSource = tmpdt;
            dgv1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode .AllCells );
        }
    }
}